home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_pyr_bucketpuzzle.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
11KB
|
421 lines
# Jones 3D Cog Script
#
# pyr_bucketpuzzle.cog
#
# Control bucket puzzle in pyramid 1
#
# [RKD]
#
# (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
# ========================================================================================
symbols
message startup
message activated
message arrived
message timer
# actors
thing player nolink local
thing indyactor nolink
# camera things
thing bucketcam nolink
# camera lookthings
thing bucketcamlook nolink
# world things
thing bucket
thing armnobucket
thing armbucketempty nolink
thing armbucketfull nolink
thing bigsprig nolink
thing lilsprig nolink
thing activatebox
# water things
thing waterplane nolink
thing sumpdump nolink
thing circlesplash nolink
thing ringghost1 nolink
thing ringghost2 nolink
thing mistghost nolink
thing tempring nolink local
thing bucketmist nolink
# sounds
sound bucketon=pyr_bucket_attach.wav local
sound bucketpour=pyr_bucket_pour.wav local
sound getwater=pyr_bucket_catch_water.wav local
sound machinecreak=pyr_bucketmachine_loop.wav local
sound bucketslap=jep_sus_crk_3.wav local
sound firstturn=jep_sus_crk_2.wav local
# indy saylines
sound contraption=inxj118.wav local
sound doohickey=inxj208.wav local
sound gadget=inxj117.wav local
sound thingwork=inxj119.wav local
sound thatthinggo=inxj113.wav local
# water surface material
material sumpmat=obj_pyr_a4dump.mat local
material entersplash=obj_pyr_a4sfx_splash.mat local
material outerpool=gen_a4_water_stillc.mat local
template ring=+ripples local
template mist=H2Ofluefx local
# underwater sectors
sector watersector0 nolink # internal
sector watersector1 nolink
sector watersector2 nolink
sector watersector3 nolink # external
sector watersector4 nolink
sector watersector5 nolink
sector watersector6 nolink
sector watersector7 nolink
#water surfaces
surface waterface3 nolink # external
surface waterface4 nolink
surface waterface5 nolink
surface waterface6 nolink
surface waterface7 nolink
#teeter keyframes
keyframe full2empty=pyr_teeter_full.key local
keyframe empty2full=pyr_teeter_empty.key local
#variables
flex buckettime=0.2 local
flex bucketdist=0.0 local
flex waterheight=0.0 local
int wateranimnum=0 local
int linenum=0 local
int cursound=0 local
int nullvalue=0 local
# subroutines
flex startscene=0.0 local
flex fixcams=0.0 local
flex makeitgo=0.0 local
flex changecam=0.0 local
flex startmachine=0.0 local
flex bucketlines=0.0 local
end
code
startup:
sleep(.01);
SetThingFlags(armbucketfull, 0x10);
SetThingFlags(armbucketempty, 0x10);
SetThingFlags(waterplane, 0x10);
SetThingFlags(sumpdump, 0x10);
SetThingFlags(bucket, 0x10);
SetThingFlags(circlesplash, 0x10);
SetThingFlags(bigsprig, 0x80000);
SetThingFlags(lilsprig, 0x80000);
SetThingLight(circlesplash, '0.4 0.4 1', .001, .01);
SetThingLight(waterplane, '.8 .8 1', .001, .01);
AttachThingToThing(bucket, armnobucket);
AttachThingToThing(circlesplash, waterplane);
AttachThingToThing(mistghost, waterplane);
AttachThingToThing(ringghost1, waterplane);
AttachThingToThing(ringghost2, waterplane);
SetFaceGeoMode(waterface3, 0);
SetFaceGeoMode(waterface4, 0);
SetFaceGeoMode(waterface5, 0);
SetFaceGeoMode(waterface6, 0);
SetFaceGeoMode(waterface7, 0);
player = GetLocalPlayerThing();
return;
activated:
# ---> Bucket
#if bucket is not activated, or gone;
if (bucket == -1) return;
if ((GetSenderRef() != bucket) && (GetSenderRef() != activatebox)) return;
DeselectWeaponWait(GetLocalPlayerThing());
# if player isn't holding the bucket, call some saylines
if (GetCurItem(player) != 117)
{
call bucketlines;
return;
}
MAKEITGO:
call startscene;
call changecam;
#play actor anim and make bucket visible
PlayMode(indyactor, 60, 0);
sleep(.5);
nullvalue = PlaySoundThing(bucketon, sumpdump, 1, 1, 10, 0);
ClearThingFlags(bucket, 0x10);
# take bucket out of inventory, pause
ChangeInv(player, 117, -1);
sleep(1);
#play actor anim to push bucket
PlayMode(indyactor, 61, 0);
sleep(.5);
nullvalue = PlaySoundThing(bucketslap, sumpdump, 1, 1, 10, 0);
nullvalue = PlaySoundThing(firstturn, sumpdump, 1, 1, 10, 0);
Rotate(armnobucket, 30, 1, buckettime);
#pull camera back
MoveToFrame(bucketcam, 1, 1.6);
MoveToFrame(bucketcamlook, 1, 1.4);
SetCameraFOV(100, 2, 3);
return;
arrived:
# ---> ArmNoBucket
#when bucket swings under the flow
if (bucketdist == 240)
{
call startmachine;
return;
}
#Make bucket lose momentum
buckettime = buckettime + .03;
bucketdist = bucketdist + 30;
Rotate(armnobucket, 30, 1, buckettime);
return;
bucketlines:
# if player is just activating without an item
if (GetCurItem(player) == 0)
{
# freeze player, start scene
StartCutscene(1);
StopThing(player);
SetActorFlags(player, 0x200000);
SetExtCamOffset('-0.15 -0.05 0.04');
sleep(.5);
# play the hint line and cycle to the next one
PlayVoice(player, contraption[linenum], 1, 1);
linenum = linenum + 1;
if (linenum == 4) linenum = 0;
sleep(.5);
# restore to normal
RestoreExtCam();
ClearActorFlags(player, 0x200000);
EndCutscene();
}
return;
startmachine:
#Destroy non-animating assembly
DestroyThing(bucket);
bucket = -1;
DestroyThing(armnobucket);
#splash
nullvalue = CreateThing(mist, bucketmist);
nullvalue = PlaySoundThing(getwater, bucketmist, 1, 1, 10, 0);
#Move camera lookthing downward and widen the view
MoveToFrame(bucketcamlook, 2, 1);
#make animated version visible and play first keyframe
ClearThingFlags(armbucketfull, 0x10);
nullvalue = PlaySoundThing(machinecreak, armbucketfull, 1, 1, 12, 1);
nullvalue = PlayKey(armbucketfull, full2empty, 4, 0x12, 1);
#create splash animation, make full bucket invisible, and show water plane
SetTimerEx(.001, 2, 0, 0);
SetThingFlags(armbucketfull, 0x10);
#set external water sectors
SetSectorFlags(watersector3, 2);
SetSectorFlags(watersector4, 2);
SetSectorFlags(watersector5, 2);
SetSectorFlags(watersector6, 2);
SetSectorFlags(watersector7, 2);
#set watersector face flags to shallow water
SetSectorSurfFlags(watersector3, 0x40000);
SetSectorSurfFlags(watersector4, 0x40000);
SetSectorSurfFlags(watersector5, 0x40000);
SetSectorSurfFlags(watersector6, 0x40000);
SetSectorSurfFlags(watersector7, 0x40000);
#set external water surface flags
SetFaceGeoMode(waterface3, 4);
SetFaceGeoMode(waterface4, 4);
SetFaceGeoMode(waterface5, 4);
SetFaceGeoMode(waterface6, 4);
SetFaceGeoMode(waterface7, 4);
# make outer water surface animate
nullValue = MaterialAnim(outerpool, 10, 1);
# put some health out there (thanks to Mighty Joe T.)
ClearThingFlags(bigsprig, 0x80000);
ClearThingFlags(lilsprig, 0x80000);
#create escape for while loop before it starts
SetTimerEx(6, 1, 0, 0);
# Indy is amazed
PlayVoice(indyactor, thatthinggo, 1, 0);
#start empty/fill cycle
while (1)
{
#prepare for bucket splash
SetTimerEx(1.3, 3, 0, 0);
#make empty bucket visible long enough to play keyframe
ClearThingFlags(armbucketempty, 0x10);
nullvalue = PlayKey(armbucketempty, empty2full, 4, 0x12, 1);
// PlayKey(armbucketempty, empty2full, 4, 0x12, 1);
SetThingFlags(armbucketempty, 0x10);
#make full bucket visible long enough to play keyframe
ClearThingFlags(armbucketfull, 0x10);
nullvalue = PlayKey(armbucketfull, full2empty, 4, 0x12, 1);
SetThingFlags(armbucketfull, 0x10);
SetTimerEx(.001, 2, 0, 0);
}
return;
changecam:
#change to bucketcam
SetCameraFocus(2, bucketcam);
SetCameraSecondaryFocus(2, bucketcamlook);
SetCurrentCamera(2);
ResetCameraFOV(0, 0);
return;
startscene:
call fixcams;
StartCutscene(1);
CopyOrientAndPos(indyactor, player);
CopyPlayerHolsters(player, indyactor);
ClearThingFlags(indyactor, 0x80000);
StopThing(player);
SetActorFlags(player, 0x200000);
SetThingFlags(player, 0x80000);
return;
timer:
if (GetSenderID() == 1)
{
#end cutscene
call fixcams;
CopyOrientAndPos(indyactor, player);
SetThingFlags(indyactor, 0x80000);
ClearThingFlags(player, 0x80000);
ClearActorFlags(player, 0x200000);
# Establish a camera position near Indy and prep follow-cam...
SetCameraPosition(1, VectorAdd(VectorTransformToOrient(player, '-0.25 -0.1 0.0'), GetThingPos(player)));
SetCurrentCamera(1);
EndCutscene();
}
if (GetSenderID() == 2)
{
#animate sump thing
nullvalue = SetMaterialCel(sumpmat, 0);
ClearThingFlags(sumpdump, 0x10);
nullValue = MaterialAnim(sumpmat, 20, 0);
nullvalue = PlaySoundThing(bucketon, armbucketempty, 1, 1, 12, 0);
nullvalue = PlaySoundThing(bucketpour, sumpdump, 1, 1, 10, 0);
sleep(.12);
#create ring and mist
tempring = CreateThing(ring, circlesplash);
nullvalue = AnimateSpriteSize(tempring, '0.1 0.1 1', '0.3 0.3 0', 2);
nullvalue = CreateThing(mist, mistghost);
ClearThingFlags(waterplane, 0x10);
#make water rise a bit when full bucket hits bottom
if (waterheight < .04)
{
nullValue = MoveThing(waterplane, '0 0 1', .002, .5);
waterheight = waterheight + .002;
# if above .1 meters, make lowest sector waterish
if (waterheight > 0.01)
{
SetSectorFlags(watersector0, 2);
SetSectorSurfFlags(watersector0, 0x40000);
}
# if above .3 meters, make upper sector waterish
if (waterheight > .03)
{
SetSectorSurfFlags(watersector1, 0x20000);
SetSectorSurfFlags(watersector2, 0x20000);
}
}
#display and animate circlesplash
ClearThingFlags(circlesplash, 0x10);
wateranimnum = MaterialAnim(entersplash, 14, 0);
sleep(.1);
SetThingFlags(sumpdump, 0x10);
#auxiliary water rings and mist
tempring = CreateThing(ring, ringghost1);
nullValue = AnimateSpriteSize(tempring, '0.1 0.1 1', '0.3 0.3 0', 2);
tempring = CreateThing(ring, ringghost2);
nullValue = AnimateSpriteSize(tempring, '0.1 0.1 1', '0.3 0.3 0', 2);
//WaitForAnimStop(wateranimnum);
//SetThingFlags(circlesplash, 0x10);
}
if (GetSenderID() == 3)
{
nullvalue = CreateThing(mist, bucketmist);
nullvalue = PlaySoundThing(getwater, bucketmist, 1, 1, 10, 0);
}
return;
fixcams:
#reset camera settings
ResetCameraFOV(0, 0);
SetCameraPosInterp(2, 0);
SetCameraLookInterp(2, 0);
SetCameraPosInterp(1, 0);
SetCameraLookInterp(1, 0);
RestoreExtCam();
return;
end